home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 853 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help: How to initialize objects created by new class[x]
  5. Date: 7 Jan 1996 23:09:27 GMT
  6. Organization: self-employed
  7. Message-ID: <4cpjr7$hlc@news.bridge.net>
  8. References: <4cicd6$lsv@news.capitalnet.com> <4cisdl$jt3@pipe9.nyc.pipeline.com>
  9. NNTP-Posting-Host: ppp-mia1-39.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16.  Carey;
  17.  
  18. >> I always call an initialization method after allocating arrays 
  19. >> this way. The technique is called "2-phase construction".
  20.  
  21. I don't know if _this_ is really what they call 2-phase construction. 
  22. The objects in the example ARE constructed, in the array declaration, 
  23. by the default constructor, i.e. they are in a valid state.
  24.  
  25. Some classes have a valid 'null state' which the default ctor creates,
  26. and some do not.
  27.  
  28. I believe that 2-phase construction is when a ctor puts the object in
  29. an invalid, unusable state, and you have to call a second function to
  30. finish constructing it. This was sometimes necessary before the era of
  31. exceptions.
  32.  
  33.     David
  34.  
  35.  
  36.